/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package interfaces;

import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import modelo.Suspeito;

/**
 *
 * @author marcieli
 */
public class FrameSuspeito extends javax.swing.JFrame {

    List<Suspeito> lista = new ArrayList<Suspeito>();
    Integer contCodigo = 0;
    Integer posicaolista;

    public FrameSuspeito() {
              /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FrameSuspeito.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FrameSuspeito.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FrameSuspeito.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FrameSuspeito.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
 
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        Traços = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        txtNome = new javax.swing.JTextField();
        txtOutros = new javax.swing.JTextField();
        ComboSexo = new javax.swing.JComboBox();
        ComboOcupacao = new javax.swing.JComboBox();
        ComboEsporte = new javax.swing.JComboBox();
        ComboCabelo = new javax.swing.JComboBox();
        ComboCarro = new javax.swing.JComboBox();
        ComboTraco = new javax.swing.JComboBox();
        jLabel12 = new javax.swing.JLabel();
        txtCod = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        ButPrimeiro2 = new javax.swing.JButton();
        ButAnterior2 = new javax.swing.JButton();
        ButProximo2 = new javax.swing.JButton();
        ButUltimo2 = new javax.swing.JButton();
        ButInserir1 = new javax.swing.JButton();
        ButConsultar1 = new javax.swing.JButton();
        ButAtualizar1 = new javax.swing.JButton();
        ButRemover1 = new javax.swing.JButton();
        ButNovo1 = new javax.swing.JButton();

        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 4));

        jLabel1.setText("Imagem");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(82, 82, 82)
                .addComponent(jLabel1)
                .addContainerGap(98, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(73, 73, 73)
                .addComponent(jLabel1)
                .addContainerGap(157, Short.MAX_VALUE))
        );

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel2.setText("Nome:");

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel4.setText("Ocupação:");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel3.setText("Sexo:");

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel5.setText("Esporte:");

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel6.setText("Cabelo:");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel7.setText("Carro:");

        Traços.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        Traços.setText("Traços:");

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel8.setText("Outros:");

        ComboSexo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Feminino", "Masculino" }));

        ComboOcupacao.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Atendente do McDonalds", "Advogado(a)", "Empresario(a)", "Professor(a) de dança", "Professor(a)", "Cozinheiro(a)" }));

        ComboEsporte.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Volei", "Futebol", "Basquete", "Alpinismo", "Peteca", "Surf" }));

        ComboCabelo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Loiro", "Ruivo", "Castanho", "Preto" }));

        ComboCarro.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Camaro", "Fusca", "Belina", "Motocicleta", "Corcel", "Fusion" }));
        ComboCarro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ComboCarroActionPerformed(evt);
            }
        });

        ComboTraco.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Tatuagem", "Cicatriz", "Machucado", "Manco", "Anel" }));

        jLabel12.setText("Código:");

        txtCod.setEditable(false);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtNome))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(ComboEsporte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addGap(18, 18, 18)
                                .addComponent(ComboCabelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel7)
                                .addGap(18, 18, 18)
                                .addComponent(ComboCarro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(Traços)
                                .addGap(18, 18, 18)
                                .addComponent(ComboTraco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(ComboOcupacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(txtOutros))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(ComboSexo, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 227, Short.MAX_VALUE)
                        .addComponent(jLabel12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtCod, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(14, 14, 14)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel3)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(ComboSexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel12)
                                .addComponent(txtCod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(18, 18, 18)
                        .addComponent(jLabel4))
                    .addComponent(ComboOcupacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(ComboEsporte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(ComboCabelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(ComboCarro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Traços)
                    .addComponent(ComboTraco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(txtOutros, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE))
                .addContainerGap())
        );

        jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Rodape.gif"))); // NOI18N

        jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Rodape.gif"))); // NOI18N

        jLabel11.setFont(new java.awt.Font("Segoe Print", 1, 24)); // NOI18N
        jLabel11.setText("Suspeitos");
        jLabel11.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Navegação"));

        ButPrimeiro2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ButPrimeiro2.setText("Primeiro");
        ButPrimeiro2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButPrimeiro2ActionPerformed(evt);
            }
        });

        ButAnterior2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ButAnterior2.setText("Anterior");
        ButAnterior2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButAnterior2ActionPerformed(evt);
            }
        });

        ButProximo2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ButProximo2.setText("Proximo");
        ButProximo2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButProximo2ActionPerformed(evt);
            }
        });

        ButUltimo2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ButUltimo2.setText("Ultimo");
        ButUltimo2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButUltimo2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ButPrimeiro2, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(38, 38, 38)
                .addComponent(ButAnterior2, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
                .addComponent(ButProximo2, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(38, 38, 38)
                .addComponent(ButUltimo2, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(19, 19, 19))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(ButPrimeiro2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(ButAnterior2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(ButUltimo2, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ButProximo2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        ButInserir1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ButInserir1.setText("Inserir");
        ButInserir1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButInserir1ActionPerformed(evt);
            }
        });

        ButConsultar1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ButConsultar1.setText("Consultar");
        ButConsultar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButConsultar1ActionPerformed(evt);
            }
        });

        ButAtualizar1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ButAtualizar1.setText("Atualizar");
        ButAtualizar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButAtualizar1ActionPerformed(evt);
            }
        });

        ButRemover1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ButRemover1.setText("Remover");
        ButRemover1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButRemover1ActionPerformed(evt);
            }
        });

        ButNovo1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ButNovo1.setText("Novo");
        ButNovo1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButNovo1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(ButInserir1, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(ButConsultar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(18, 18, 18)
                        .addComponent(ButAtualizar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(18, 18, 18)
                        .addComponent(ButRemover1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(18, 18, 18)
                        .addComponent(ButNovo1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(116, 116, 116))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(21, 21, 21)
                            .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addGap(18, 18, 18)
                            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 318, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 329, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(42, 42, 42)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ButInserir1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ButConsultar1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ButAtualizar1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ButRemover1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ButNovo1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void ComboCarroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ComboCarroActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_ComboCarroActionPerformed

    private void ButInserir1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButInserir1ActionPerformed
        if (txtNome.getText().equals("") || ComboSexo.getSelectedItem().equals("")
                || ComboOcupacao.getSelectedItem().equals("") || ComboEsporte.getSelectedItem().equals("")
                || ComboCabelo.getSelectedItem().equals("") || ComboCarro.getSelectedItem().equals("")
                || ComboTraco.getSelectedItem().equals("") || txtOutros.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Todos os campos são obrigatórios");

        } else {

            Suspeito s = new Suspeito();
            // p.setCodigo(Integer.parseInt(jTFCodigo.getText()));
            s.setCodigo(contCodigo++);
            s.setNome(txtNome.getText());
            s.setSexo(ComboSexo.getSelectedItem().toString());
            s.setOcupacao(ComboOcupacao.getSelectedItem().toString());
            s.setEsporte(ComboEsporte.getSelectedItem().toString());
            s.setCabelo(ComboCabelo.getSelectedItem().toString());
            s.setCarro(ComboCarro.getSelectedItem().toString());
            s.setTracos(ComboTraco.getSelectedItem().toString());
            s.setOutros(txtOutros.getText());
            lista.add(s);
            JOptionPane.showMessageDialog(null, "Suspeito inserido com sucesso");
             txtCod.setText(null);
        txtNome.setText(null);

        ComboSexo.setSelectedItem(null);
        ComboOcupacao.setSelectedItem(null);
        ComboEsporte.setSelectedItem(null);
        ComboCabelo.setSelectedItem(null);
        ComboCarro.setSelectedItem(null);
        ComboTraco.setSelectedItem(null);
        txtOutros.setText(null);
        }
    }//GEN-LAST:event_ButInserir1ActionPerformed

    private void ButConsultar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButConsultar1ActionPerformed
        String filtro = JOptionPane.showInputDialog("Informe o nome da cidade que deseja filtrar");

        boolean encontrou = false;
        int i = 0;
        for (Suspeito s : lista) {
            if (s.getNome().equals(filtro)) {
                s.setCodigo(contCodigo++);
                txtNome.setText(s.getNome());
                ComboSexo.setSelectedItem(s.getSexo());
                ComboOcupacao.setSelectedItem(s.getOcupacao());
                ComboEsporte.setSelectedItem(s.getEsporte());
                ComboCabelo.setSelectedItem(s.getCabelo());
                ComboCarro.setSelectedItem(s.getCarro());
                ComboTraco.setSelectedItem(s.getTracos());
                txtOutros.setText(s.getOutros());
                encontrou = true;
                posicaolista = i;
                break;

            }
            i++;
        }
        if (encontrou == false) {
            JOptionPane.showMessageDialog(null, "Suspeito não encontrada");
        }
    }//GEN-LAST:event_ButConsultar1ActionPerformed

    private void ButAtualizar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButAtualizar1ActionPerformed
        if (txtNome.getText().equals("") || ComboSexo.getSelectedItem().equals("")
                || ComboOcupacao.getSelectedItem().equals("") || ComboEsporte.getSelectedItem().equals("")
                || ComboCabelo.getSelectedItem().equals("") || ComboCarro.getSelectedItem().equals("")
                || ComboTraco.getSelectedItem().equals("") || txtOutros.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Todos os campos são obrigatórios");
        } else {

            Integer codigo = Integer.parseInt(txtCod.getText());
            for (Suspeito s : lista) {
                if (codigo == s.getCodigo()) {

                    s.setNome(txtNome.getText());
            s.setSexo(ComboSexo.getSelectedItem().toString());
            s.setOcupacao(ComboOcupacao.getSelectedItem().toString());
            s.setEsporte(ComboEsporte.getSelectedItem().toString());
            s.setCabelo(ComboCabelo.getSelectedItem().toString());
            s.setCarro(ComboCarro.getSelectedItem().toString());
            s.setTracos(ComboTraco.getSelectedItem().toString());
            s.setOutros(txtOutros.getText()); 
                    break;
                }
            }
            JOptionPane.showMessageDialog(null, "Suspeito atualizado com sucesso");

        }
    }//GEN-LAST:event_ButAtualizar1ActionPerformed

    private void ButRemover1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButRemover1ActionPerformed
        Integer confirma = JOptionPane.showConfirmDialog(null, "Dejesa excluir");
        Integer codigo = Integer.parseInt(txtCod.getText());

        // Percorrer lista atras da pessoa que sera removida
        if (confirma == 0) {
            for (Suspeito s : lista) {
                if (s.getCodigo() == codigo) {
                    //remove da lista
                    lista.remove(s);
                    // para o for
                    break;

                }
                 txtCod.setText(null);
        txtNome.setText(null);

        ComboSexo.setSelectedItem(null);
        ComboOcupacao.setSelectedItem(null);
        ComboEsporte.setSelectedItem(null);
        ComboCabelo.setSelectedItem(null);
        ComboCarro.setSelectedItem(null);
        ComboTraco.setSelectedItem(null);
        txtOutros.setText(null);

            }
        }
    }//GEN-LAST:event_ButRemover1ActionPerformed

    private void ButNovo1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButNovo1ActionPerformed
        txtCod.setText(null);
        txtNome.setText(null);

        ComboSexo.setSelectedItem(null);
        ComboOcupacao.setSelectedItem(null);
        ComboEsporte.setSelectedItem(null);
        ComboCabelo.setSelectedItem(null);
        ComboCarro.setSelectedItem(null);
        ComboTraco.setSelectedItem(null);
        txtOutros.setText(null);
    }//GEN-LAST:event_ButNovo1ActionPerformed

    private void ButPrimeiro2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButPrimeiro2ActionPerformed

        Suspeito s = lista.get(0);
        txtCod.setText(s.getCodigo().toString());
        txtNome.setText(s.getNome());
        ComboSexo.setSelectedItem(s.getSexo());
        ComboOcupacao.setSelectedItem(s.getOcupacao());
        ComboEsporte.setSelectedItem(s.getEsporte());
        ComboCabelo.setSelectedItem(s.getCabelo());
        ComboCarro.setSelectedItem(s.getCarro());
        ComboTraco.setSelectedItem(s.getTracos());
        txtOutros.setText(s.getOutros());

        posicaolista = 0;
    }//GEN-LAST:event_ButPrimeiro2ActionPerformed

    private void ButAnterior2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButAnterior2ActionPerformed
        if (posicaolista > 0) {
            posicaolista = posicaolista - 1;
            Suspeito s = lista.get(posicaolista);

            txtCod.setText(s.getCodigo().toString());
            txtNome.setText(s.getNome());
            ComboSexo.setSelectedItem(s.getSexo());
            ComboOcupacao.setSelectedItem(s.getOcupacao());
            ComboEsporte.setSelectedItem(s.getEsporte());
            ComboCabelo.setSelectedItem(s.getCabelo());
            ComboCarro.setSelectedItem(s.getCarro());
            ComboTraco.setSelectedItem(s.getTracos());
            txtOutros.setText(s.getOutros());

            posicaolista = lista.size() - 1;
        }
    }//GEN-LAST:event_ButAnterior2ActionPerformed

    private void ButProximo2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButProximo2ActionPerformed

        if (posicaolista < (lista.size() - 1)) {
            posicaolista = posicaolista + 1;
            Suspeito s = lista.get(posicaolista);
            txtCod.setText(s.getCodigo().toString());
            txtNome.setText(s.getNome());
            ComboSexo.setSelectedItem(s.getSexo());
            ComboOcupacao.setSelectedItem(s.getOcupacao());
            ComboEsporte.setSelectedItem(s.getEsporte());
            ComboCabelo.setSelectedItem(s.getCabelo());
            ComboCarro.setSelectedItem(s.getCarro());
            ComboTraco.setSelectedItem(s.getTracos());
            txtOutros.setText(s.getOutros());
            posicaolista = lista.size() - 1;
        }
    }//GEN-LAST:event_ButProximo2ActionPerformed

    private void ButUltimo2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButUltimo2ActionPerformed
        Suspeito s = lista.get((lista.size() - 1));
        txtCod.setText(s.getCodigo().toString());

        txtNome.setText(s.getNome());
        ComboSexo.setSelectedItem(s.getSexo());
        ComboOcupacao.setSelectedItem(s.getOcupacao());
        ComboEsporte.setSelectedItem(s.getEsporte());
        ComboCabelo.setSelectedItem(s.getCabelo());
        ComboCarro.setSelectedItem(s.getCarro());
        ComboTraco.setSelectedItem(s.getTracos());
        txtOutros.setText(s.getOutros());
        posicaolista = lista.size() - 1;
    }//GEN-LAST:event_ButUltimo2ActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ButAnterior2;
    private javax.swing.JButton ButAtualizar1;
    private javax.swing.JButton ButConsultar1;
    private javax.swing.JButton ButInserir1;
    private javax.swing.JButton ButNovo1;
    private javax.swing.JButton ButPrimeiro2;
    private javax.swing.JButton ButProximo2;
    private javax.swing.JButton ButRemover1;
    private javax.swing.JButton ButUltimo2;
    private javax.swing.JComboBox ComboCabelo;
    private javax.swing.JComboBox ComboCarro;
    private javax.swing.JComboBox ComboEsporte;
    private javax.swing.JComboBox ComboOcupacao;
    private javax.swing.JComboBox ComboSexo;
    private javax.swing.JComboBox ComboTraco;
    private javax.swing.JLabel Traços;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JTextField txtCod;
    private javax.swing.JTextField txtNome;
    private javax.swing.JTextField txtOutros;
    // End of variables declaration//GEN-END:variables
}
